﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SearchTicket.aspx.cs" Inherits="user_SearchTicket" %>


<html>


<head id="Head1" runat="server">
    <link href="../css/application.css" rel="stylesheet" type="text/css" />
    <link href="../css/Style.css" rel="stylesheet" type="text/css" />
    <link href="../css/common.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../js/kpmg-2.0.0.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function checkNull() {
            var result = true;

            var No = document.getElementById("<%=TicketNum.ClientID %>").value;
            var Req = document.getElementById("<%=Requestor.ClientID %>").value;
            var Asgn = document.getElementById("<%=AssignedTo.ClientID %>").value;
            var sd = document.getElementById("<%=ListStartDate.ClientID %>").value;
            var ed = document.getElementById("<%=ListEndDate.ClientID %>").value;
//            var time = setTimeout("unlockBut()", 2000);
//            var removeRemindTime = setTimeout("removeRemind()", 3000);
            if (No == "" && Req == "" && Asgn == "" && sd == "" && ed == "") {
                var remind = document.getElementById("<%=Remind.ClientID %>");
                remind.innerHTML = "Please fill in one information at least ";

                //lockBut();
                result = false;
            }
            var hidden = document.getElementById("<%=HiddenField1.ClientID %>").value;
            if (hidden == "b") {
                var name = document.getElementById("<%=SaveName.ClientID %>").value;
                var owner = document.getElementById("<%=SaveOwnerStaffNo.ClientID %>").value;
                //var created = document.getElementById("<%=SaveCreatedUser.ClientID %>").value;
                if (name == "" || owner == "") {
                    //tishi

                    var saveConRemind = document.getElementById("<%=SaveConRemind.ClientID %>");
                    saveConRemind.innerHTML = "Please fill in all informations";
                    result = false;
                }
            }
            return result;
        }

        function removeRemind() { 
            var getRemind=document.getElementById("<%=Remind.ClientID %>");
            getRemind.innerHTML = " ";
            var getSaveRemind = document.getElementById("<%=SaveConRemind.ClientID %>");
            getSaveRemind.innerHTML = "";
            
        }


        function SaveBut_Click() {
            if (checkNull()==true) {
                ShowSaveMess();
            }

        }

        function unlockBut() {
            if (document.getElementById("<%=Remind.ClientID %>").innerHTML != "") {
                document.getElementById("<%=SearchBut.ClientID %>").removeAttribute("disabled");               
            }
        }
        function chooseSaveOrNot() {
            var radio = document.getElementById("ChooseRadioButton");

            if (radio.getAttribute("Checked")) {
                var radioValue = radio.Value;
                if (radioValue == "Don't save") {
                    lockTextBox();
                    return false;
                }
                unlockTextBox();
                return true;

            }
        }

        function lockTextBox() {
            document.getElementById("<%=SaveName.ClientID %>").setAttribute("disabled", "disabled");
            document.getElementById("<%=SaveOwnerStaffNo.ClientID %>").setAttribute("disabled", "disabled");
            //document.getElementById("<%=SaveCreatedUser.ClientID %>").setAttribute("disabled", "disabled");
            document.getElementById("<%=HiddenField1.ClientID %>").value = "a";   
        }

        function unlockTextBox() {
            document.getElementById("<%=SaveName.ClientID %>").removeAttribute("disabled");
            document.getElementById("<%=SaveOwnerStaffNo.ClientID %>").removeAttribute("disabled");
            //document.getElementById("<%=SaveCreatedUser.ClientID %>").removeAttribute("disabled");
            document.getElementById("<%=HiddenField1.ClientID %>").value = "b";            
        }

        function checkSaveConInfoNull() {
            
            var saveName = document.getElementById("<%=SaveName.ClientID %>").value;
            if (saveName == "") {
                var saveConRemind = document.getElementById("<%=SaveConRemind.ClientID %>");
                saveConRemind.innerHtml = "Please fill in the name";
            }
        }

    </script>

    <title></title>
</head>
<body>
    <form runat="server">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td style="padding-bottom:20px;">
                <div style="padding-bottom:0px;">
                    <span id="LabelID1" style="font-size:11px;font-family:Arial;color:#585858;">
                        You are here:
                    </span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
            <span id="TitleName" style="font-size:18px;font-family:Arial;color:#000044;font-weight:bold;padding-bottom:20px;">
                Search Ticket Request
            </span>
            </td>
        </tr>
    </table>

    <table class="TableStyle">
      
        <tr><td></td><td></td></tr>
        <tr><td></td><td></td></tr>
        <tr>
            <td class="LableStyle">
               Ticket number 
            </td>
            <td class="InputStyle" style="padding-left:0px;">
                <asp:TextBox ID="TicketNum" runat="server"/>
            </td>
        </tr>
        <tr>
           <td class="LableStyle">
            Requestor 
           </td>
           <td class="InputStyle">
                <asp:TextBox ID="Requestor" runat="server"/>
                <asp:HiddenField ID="RequestorNo" runat="server" />
           </td>
        </tr>
        <tr>
            <td class="LableStyle">
                Assigned to
            </td>
            <td class="InputStyle">
                <asp:TextBox ID="AssignedTo" runat="server"/>
                <asp:HiddenField ID="AssignedToNo" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="LableStyle">
                StartDate
            </td>
            <td class="InputStyle">
                <asp:TextBox ID="ListStartDate" runat="server" CssClass="InputStyle2"  />
            </td>
            <td class="LableStyle" style="width:20px;padding-left:1px">
                EndDate
            </td>
            <td class="InputStyle" >
                <asp:TextBox ID="ListEndDate" runat="server"  CssClass="InputStyle2" />
            </td>
        </tr>
        <tr>
            <td class="RemindClass">
                 <asp:Label ID="Remind" runat="server" Text=""></asp:Label>
            </td>



        </tr>
    


    
    <tr>
        <td class="SaveConStyle" style="padding-left:20px">
           
           
           
           <%-- <asp:RadioButton ID="NotSaveRadioButton" runat="server" Text="Don't save" GroupName="choose" ></asp:RadioButton >--%>
           <input type="radio" name="ChooseRadioButton"  value="Don't save" onclick="lockTextBox()" checked="checked"/>Don't save
        </td>
    </tr>
    <tr>
        <td class="SaveConStyle" style="padding-left:20px">
            <%--<asp:RadioButton ID="SaveRadioButton" runat="server" Text="Save condition as" GroupName="choose"></asp:RadioButton >--%>
            <input type="radio" name="ChooseRadioButton" value="Save condition as" onclick="unlockTextBox()" />Save condition as
        </td>
    </tr>
    <tr>
        <td class="SaveConStyle" style="padding-left:50px">
            Search Name
        </td>
        <td>
            <asp:TextBox ID="SaveName" runat="server" CssClass="InputStyle" Enabled="false"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="SaveConStyle"style="padding-left:50px">
            Owner Staff


        </td>
        <td>
            <asp:TextBox ID="SaveOwnerStaffNo" runat="server" CssClass="InputStyle" Enabled="false"></asp:TextBox>
            <asp:HiddenField ID="ShowSaveOwnerStaffNo" runat="server" />
        </td>
    </tr>
<!--
    <tr>
        <td class="SaveConStyle"style="padding-left:50px">
            Created User
        </td>
        <td>
            <asp:TextBox ID="SaveCreatedUser" runat="server" CssClass="InputStyle" Text="112m2"></asp:TextBox>
        </td>
    </tr>
-->
    <tr><td class="RemindClass"><asp:Label ID="SaveConRemind" runat="server" Text=""></asp:Label></td></tr>


</table>




    <table>
        <tr style="padding-top:20px;">
            <td style="padding-left:50px">
                <asp:Button ID="SearchBut" runat="server" Text="Search tickets" 
                    OnClientClick="return checkNull()" OnClick="Search_Click" CssClass="ButtonStyle"/>
            </td>
        </tr>

    </table>

    
    
    <div>
        <a href="../Pages/MyView.aspx" class="HrefStyle"><span class="LableStyle">MyView</span></a> <br />  
        <!--
        <span class="LableStyle">Your staff No.</span>
        <asp:TextBox ID="tb_staffNo" runat="server" Text="12345"></asp:TextBox>
        &nbsp
        <asp:Button ID="btn_myview" runat="server" Text="Get" 
            onclick="btn_myview_Click"  CssClass="ButtonStyle"/>
        -->
    </div>
    <asp:HiddenField ID="HiddenField1" runat="server"/>

    </form>
</body>
    
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%=ListStartDate.ClientID %>").kmpgCalendar();
            $("#<%=ListEndDate.ClientID %>").kmpgCalendar();
        })

    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%=Requestor.ClientID %>").kpmgAutoCompleted();
            $("#<%=AssignedTo.ClientID %>").kpmgAutoCompleted();
            //$("#<%=ShowSaveOwnerStaffNo.ClientID %>").kpmgAutoCompleted();
            $("#<%=SaveOwnerStaffNo.ClientID %>").kpmgAutoCompleted();
        })
      


    </script>

</html>
